// 车辆和油耗记录相关的类型定义

// 车辆响应
export interface VehicleResponse {
  id: number;
  name: string;
  brand: string;
  model: string;
  license_plate: string;
  year?: number | null;
  is_active: boolean;
  notes?: string | null;
  family_id: number;
  created_at: string;
  updated_at?: string | null;
  family_name?: string | null;
}

// 车辆创建
export interface VehicleCreate {
  name: string;
  brand: string;
  model: string;
  license_plate: string;
  year?: number | null;
  is_active?: boolean;
  notes?: string | null;
}

// 车辆更新
export interface VehicleUpdate {
  name?: string | null;
  brand?: string | null;
  model?: string | null;
  license_plate?: string | null;
  year?: number | null;
  is_active?: boolean | null;
  notes?: string | null;
}

// 车辆列表响应
export interface VehicleList {
  vehicles: VehicleResponse[];
  total: number;
  skip: number;
  limit: number;
}

// 油耗统计信息
export interface FuelConsumptionStats {
  avg_fuel_consumption: number;
  total_fuel_cost: number;
  total_fuel_amount: number;
  total_distance: number;
  record_count: number;
  avg_fuel_price: number;
}

// 加油记录响应
export interface VehicleFuelRecordResponse {
  id: number;
  vehicle_id: number;
  current_mileage: number;
  fuel_amount: number;
  fuel_cost: number;
  fuel_price: number;
  gas_station_type: string;
  notes?: string | null;
  refuel_date: string;
  family_id: number;
  fuel_consumption?: number | null;
  created_at: string;
  updated_at?: string | null;
  family_name?: string | null;
  vehicle_name?: string | null;
}

// 加油记录创建
export interface VehicleFuelRecordCreate {
  vehicle_id: number;
  current_mileage: number;
  fuel_amount: number;
  fuel_cost: number;
  fuel_price: number;
  gas_station_type: string;
  notes?: string | null;
  refuel_date: string;
}

// 加油记录更新
export interface VehicleFuelRecordUpdate {
  vehicle_id?: number | null;
  current_mileage?: number | null;
  fuel_amount?: number | null;
  fuel_cost?: number | null;
  fuel_price?: number | null;
  gas_station_type?: string | null;
  notes?: string | null;
  refuel_date?: string | null;
}

// 加油记录列表响应
export interface VehicleFuelRecordList {
  fuel_records: VehicleFuelRecordResponse[];
  total: number;
  skip: number;
  limit: number;
}

// 带统计信息的加油记录响应
export interface VehicleFuelRecordWithStats {
  record: VehicleFuelRecordResponse;
  stats?: FuelConsumptionStats | null;
}

// 带油耗统计的车辆响应
export interface VehicleWithFuelStats {
  vehicle: VehicleResponse;
  latest_fuel_record?: VehicleFuelRecordResponse | null;
  fuel_stats?: FuelConsumptionStats | null;
}

// 车辆列表查询参数
export interface VehicleListParams {
  skip?: number;
  limit?: number;
  is_active?: boolean | null;
}

// 加油记录列表查询参数
export interface VehicleFuelRecordListParams {
  skip?: number;
  limit?: number;
  start_date?: string | null;
  end_date?: string | null;
  gas_station_type?: string | null;
  vehicle_id?: number | null;
}

// 油耗统计查询参数
export interface FuelConsumptionStatsParams {
  start_date?: string | null;
  end_date?: string | null;
  vehicle_id?: number | null;
}

// 加油费用汇总查询参数
export interface FuelCostSummaryParams {
  start_date?: string | null;
  end_date?: string | null;
  vehicle_id?: number | null;
}
